<template>
  <span :class="className">{{ index + 1 }}: {{ msg }}</span>
</template>

<script>
export default {
  props: ["index"],
  mounted() {
    this.$bus.$on(`submi${this.index}`, (flag) =>
      flag == "错误"
        ? ((this.msg = flag), (this.className = "error"))
        : flag == "正确"
        ? ((this.msg = flag), (this.className = "right"))
        : (this.className = "undo")
    );
  },
  data() {
    return {
      status: "-1",
      msg: "未完成",
      className: "",
    };
  },
};
</script>

<style scoped>
.right {
  color: green;
}
.error {
  color: red;
}
.undo {
  color: #ccc;
}
</style>
